<!-- 列表 -->
<extend name="Public:layout" />
<block name="title"><{$authName}></block>

<block name="pluginCSS">
</block>
<block name="CSS"></block>

<block name="loadJS">
<script src="__PUBLIC__/admin/scripts/layer/layer.js" type="text/javascript"></script>  

</block>
<block name="setJS">
<script src="__PUBLIC__/Admin/scripts/custom/tablePay.js"></script>
<script>
var ajaxUrl="<{:U('index')}>";
</script>
</block>
<block name="initJS">
TablePay.init();
</block>
<block name="pagetitle">增删改查</block>
<block name="page">
<div class="row">
  <div class="col-md-12">
    <div class="portlet">
      <div class="portlet-title">
        <div class="caption">
          <i class="fa <{$authIco}>"></i><{$authName}>
        </div>
        
        <div class="actions">
          <a class="btn default green-stripe" id="table_new" data-toggle="modal" href="javascript:history.back();">
            <i class="fa fa-reply"></i>
            <span class="hidden-480">返回</span>
          </a>
        </div>
        
      </div>
      <div class="portlet-body">    
        <form class="form-horizontal" method="post">
            <input type="hidden" name="id" id="id" value="<{$pay.id}>" />
            <input type='hidden' name='payCode' id='payCode' value='<{$pay.payCode}>'/>
            <input type='hidden' name='payIcon' id='payIcon' value='__Public__/Admin/img/payment/weixin.jpg'/>
            <div class="form-group">
              <label class="col-sm-3 control-label" for="payName">支付名称</label>
              <div class="col-md-6">
                <input type="text" class="form-control" placeholder="支付名称" name="payName" id="payName"  value="<{$pay.payName}>" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label" for="appid">APPID</label>
              <div class="col-md-6">
                <input type="text" class="form-control" placeholder="APPID" name='appid' id='appid' value="<{$pay.appid}>" />
              </div>
            </div>

            <div class="form-group">
              <label class="col-sm-3 control-label" for="mchId">微信支付商户号(mch_id)</label>
              <div class="col-md-6">
                <input type="text" class="form-control" placeholder="微信支付商户号(mch_id)" name='mchId' id='mchId' value="<{$pay.mchId}>" />
              </div>
            </div>

            <div class="form-group">
              <label class="col-sm-3 control-label" for="apiKey">API密钥(key)</label>
              <div class="col-md-6">
                <input type="text" class="form-control" placeholder="API密钥(key)" name='apiKey' id='apiKey' value="<{$pay.apiKey}>" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label" for="appsecret">Appsecret</label>
              <div class="col-md-6">
                <input type="text" class="form-control" placeholder="Appsecret" name='appsecret' id='appsecret' value="<{$pay.appsecret}>" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label" for="payDesc">支付方式描述</label>
              <div class="col-md-6">
                <input type="text" class="form-control" placeholder="支付方式描述" name="payDesc" id="payDesc"  value="<{$pay.payDesc}>" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label" for="payOrder">排序号</label>
              <div class="col-md-6">
                <input type="text" class="form-control" placeholder="排序号" name="payOrder" id="payOrder"  value="<{$pay.payOrder}>" />
              </div>
            </div>
            <div class="form-group">
                    <label class="col-sm-3 control-label" for="isOnline">是否在线支付</label>
                    <div class="col-md-6">
                    <div class="radio-list">
                      <label class="radio-inline">
                      <input type="radio" name="isOnline" id="optionsRadios1" value="1" <if condition="$pay.isOnline eq 1">checked</if> disabled> 是 </label>
                      <label class="radio-inline">
                      <input type="radio" name="isOnline" id="optionsRadios2" value="0" <if condition="$pay.isOnline eq 0">checked</if> disabled> 否 </label>
                    </div>
                    </div>
                  </div>

            <div class="form-group fluid">
                <div class="col-md-offset-3 col-md-9">
                  <button type="submit" class="btn blue">保存</button>
                  <button type="reset" class="btn default">取消</button>
                </div>
              </div>  
</form>     </div>
    </div>
  </div>
</div>
</block>
   function edit(){
	   var params = {};
	   params.id = $('#id').val();
	   params.payName = $('#payName').val();
	   params.payDesc = $('#payDesc').val();
	   params.payOrder = $('#payOrder').val();
	   
	   var configparams = {};
	   configparams.appId = $('#appId').val();
	   configparams.mchId = $('#mchId').val();
	   configparams.apiKey = $('#apiKey').val();
	   configparams.appsecret = $('#appsecret').val();
	   configparams.payIcon = $('#payIcon').val();
	   
	   params.payConfig = configparams;
	   Plugins.waitTips({title:'信息提示',content:'正在提交数据，请稍后...'});
		$.post("{:U('Admin/Payments/edit')}",params,function(data,textStatus){
			var json = WST.toJson(data);
			if(json.status=='1'){
				Plugins.setWaitTipsMsg({ content:'操作成功',timeout:1000,callback:function(){
				   location.href="{:U('Admin/Payments/index')}";
				}});
			}else{
				Plugins.closeWindow();
				Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
			}
		});
   }
   </script>
   